package com.cyzy.config;



import com.cyzy.dto.Message;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CacheConfig {
    @Bean
    public Cache<String, Message> productCache(){
        return Caffeine.newBuilder()
                .maximumSize(10_000)
                .expireAfterWrite(30, java.util.concurrent.TimeUnit.MINUTES)
                .recordStats()
                .build();
    }
}
